//
//  EverydayDetailFisrtCell.m
//  littleLight's Project-A
//
//  Created by dllo on 16/5/18.
//  Copyright © 2016年 light. All rights reserved.
//

#import "EverydayDetailFisrtCell.h"
#import <UIImageView+WebCache.h>


@implementation EverydayDetailFisrtCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
        
    }
    return self;
}



- (void)createView
{
    self.imageV = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageV];
   // self.imageV.contentMode = UIViewContentModeScaleAspectFill;
    
    self.label = [[UILabel alloc] init];
    [self.contentView addSubview:self.label];
    self.label.font = [UIFont systemFontOfSize:14];
    self.label.numberOfLines = 0;
    
    
    
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imageV.frame = CGRectMake(25, 10, self.contentView.frame.size.width - 50, 250);
    
   
   // [self.imageV sizeToFit];
    self.label.frame = CGRectMake(25, self.imageV.frame.size.height + 10 + 10, self.contentView.frame.size.width - 50, 0);
    

    [self.label sizeToFit];
    
    
    
    
}

- (void)setModel:(SpotListModel *)model
{
    _model = model;
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:_model.photo_s]];
    self.label.text = _model.myText;
    //计算文字高度
//    
//    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:17],NSFontAttributeName, nil];
//    //这里的宽度一定要和我们显示文字的label的宽度一样;
//    CGRect rect = [model.text boundingRectWithSize:CGSizeMake(self.contentView.frame.size.width, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
//  
   // self.rectBlock(rect.size.height);
    
}







@end
